import { request } from '@umijs/max';

const traceabilityQueryList = async (id: string) => {
  try {
    const response = await request('/api/traceabilityQuery', {
      method: 'POST',
      data: { id },
    });

    if (response && response.success) {
      console.log(response.data);

      return response.data;
    } else {
      throw new Error(response.message || '未知错误');
    }
  } catch (error) {
    console.error('请求出错:', error);
    throw error;
  }
};

export default traceabilityQueryList;
